<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class OrderCommission extends Model
{
    //佣金类型：1买家邀请，2卖家邀请，3vip买家邀请，4vip卖家邀请
    const TYPE_USER_INVITE = 1;
    const TYPE_PUBLISHER_INVITE = 2;
    const TYPE_USER_VIP_INVITE = 3;
    const TYPE_PUBLISHER_VIP_INVITE = 4;

    //状态：1待处理，2成功，3失败
    const STATUS_PENDING = 1;
    const STATUS_SUCCESS = 2;
    const STATUS_FAILURE = 3;

    /**
     * 是否用户邀请
     *
     * @return bool
     */
    public function isUserInvite()
    {
        return in_array($this->type, [self::TYPE_USER_INVITE, self::TYPE_USER_VIP_INVITE]);
    }

    /**
     * 是否卖家邀请
     *
     * @return bool
     */
    public function isPublisherInvite()
    {
        return in_array($this->type, [self::TYPE_PUBLISHER_INVITE, self::TYPE_PUBLISHER_VIP_INVITE]);
    }
}
